package com.mobi.Survey.video;


/**
 * 
 * <p>
 * <b>Author:</b> Yahya Arshad
 * <p>
 * <b>Company:</b> Mobi Media Soft
 * <p>
 * <b> Website:</b> www.mobimediasoft.com
 * <p>
 * YouTubeUtility.java
 */

public class YouTubeUtility
{

	/**
	 * Passing a Standard youtube url
	 * http://www.youtube.com/watch?v=-te7l4MZp5U&feature=g-all-lik will return
	 * youtube id -te7l4MZp5U
	 * 
	 * @param youtubeUrl
	 * @return
	 */
	public static final String getVideoIdFromUrl(String youtubeUrl)
	{
		String video_id = youtubeUrl.split("v=")[1];
		int ampersandPosition = video_id.indexOf('&');
		if (ampersandPosition != -1)
		{
			video_id = video_id.substring(0, ampersandPosition);
		}

		return video_id;

	}

}